package secondary_classes;

import java.util.Comparator;

public class OrdersComparatorBidIdAskId implements Comparator<Order> {

	@Override
	public int compare(Order arg0, Order arg1) {
		int result = 0;
		
		if (arg0.getBidId().equals(arg1.getBidId()) && arg0.getAskId().equals(arg1.getAskId())) {
			return 0;
		}
		
		if (arg0.getBidId().compareTo(arg1.getBidId()) < 0) {
			result = -1;
		} else if (arg0.getBidId().compareTo(arg1.getBidId()) > 0) {
			result = 1;
		} else {
			if (arg0.getAskId().compareTo(arg1.getAskId()) < 0) {
				result = -1;
			} else if (arg0.getAskId().compareTo(arg1.getAskId()) > 0) {
				result = 1;
			}
		}
		return result;
	}

}
